package com.yulongtian.weekCompetition.month202212.week2;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yulongTian
 * @create 2022-12-10 23:21
 */
public class Test03 {
    public static void main(String[] args) {

    }

    public int maxJump(int[] stones) {
        int res=0;

        int len=stones.length;

        List<Integer> up=new ArrayList<>();
        List<Integer> down=new ArrayList<>();

        up.add(0);
        down.add(0);
        for (int i = 0; i < stones.length; i++) {
            if((i&1)==1&&i!=len-1){
                up.add(stones[i]);
            }
            if((i&1)==0&&i!=len-1){
                down.add(stones[i]);
            }
        }
        up.add(stones[len-1]);
        down.add(stones[len - 1]);

        for (int i = 0; i < up.size()-1; i++) {
            res=Math.max(res,up.get(i+1)-up.get(i));
        }
        for (int i = 0; i < down.size()-1; i++) {
            res=Math.max(res,down.get(i+1)-down.get(i));
        }





        return res;
    }


}
